package com.trendytech.tds.common.mybatis;

/**
 * Oracle数据库方言实现
 *
 */
public class OracleDialect implements Dialect {

	@Override
	public String getLimitString(String sql, int offset, int limit) {
		sql = sql.trim();
		StringBuilder pagingSelect = new StringBuilder(sql.length() + 100);
		pagingSelect
				.append("select * from ( select row_.*, rownum rownum_ from ( ");
		pagingSelect.append(sql);
		pagingSelect.append(" ) row_ ) where rownum_ > ").append(offset)
				.append(" and rownum_ <= ").append(offset + limit);
		return pagingSelect.toString();
	}

}
